package com.gk.panda.apis.controller;

import com.dahuatech.icc.exception.ClientException;
import com.gk.panda.apis.entity.DataVisualization.vo.*;
import com.gk.panda.apis.service.DataVisualizationService;
import com.gk.panda.commons.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @ClassName: DataVisualizationController
 * @Description: 数据可视化
 * @author: Sir.yang
 * @date: 2022/11/9 11:07
 * @version: 1.0
 **/
@RestController
@Api(tags = "数据可视化")
@RequestMapping("/edmp/dataVisualization")
public class DataVisualizationController {

    @Autowired
    private DataVisualizationService dataVisualizationService;

    @ApiOperation("获取靶向短信登录地址")
    @GetMapping("/getSmsLoginUrl")
    public Result<String> getSmsLoginUrl() {
        return Result.ok(dataVisualizationService.getSmsLoginUrl());
    }

    @ApiOperation("获取靶向短信统计数据")
    @GetMapping("/getTargetedSmsData")
    public Result<TargetedSmsDataVo> getTargetedSmsData() {
        return Result.ok(dataVisualizationService.getTargetedSmsData());
    }

    @ApiOperation("区域热力人数数据统计")
    @GetMapping("/getElectronicFenceCount")
    public Result<Map<String,Object>> getElectronicFenceCount() throws Exception {
        return Result.ok(dataVisualizationService.getElectronicFenceCount());
    }

    @ApiOperation("监控设备数据统计")
    @GetMapping("/getMonitoringEquipmentCount")
    public Result<MonitoringEquipmentVo> getMonitoringEquipmentCount(@RequestParam(value = "orgId") String orgId) {
        return Result.ok(dataVisualizationService.getMonitoringEquipmentCount(orgId));
    }

    @ApiOperation("巡护样线数据统计")
    @GetMapping("/getTransectCount")
    public Result<Integer> getTransectCount(@RequestParam(value = "orgId") String orgId) {
        return Result.ok(dataVisualizationService.getTransectCount(orgId));
    }

    @ApiOperation("生物多样性数据统计")
    @GetMapping("/getBiodiversityCount")
    public Result<BiodiversityCountVo> getBiodiversityCount(@RequestParam(value = "orgId") String orgId) {
        return Result.ok(dataVisualizationService.getBiodiversityCount(orgId));
    }

    @ApiOperation("实时抓怕数据统计")
    @GetMapping("/getRealTimeFearCount")
    public Result<Map<String,Object>> getRealTimeFearCount() throws ClientException {
        return Result.ok(dataVisualizationService.getRealTimeFearCount());
    }

    @ApiOperation("巡护里程数据统计")
    @GetMapping("/getPatrolMileageCount")
    public Result<PatrolMileageCountVo> getPatrolMileageCount(@RequestParam(value = "orgId") String orgId) {
        return Result.ok(dataVisualizationService.getPatrolMileageCount(orgId));
    }

    @ApiOperation("巡护事件数据统计")
    @GetMapping("/getPatrolIncidentsCount")
    public Result<PatrolIncidentsCountVo> getPatrolIncidentsCount(@RequestParam(value = "orgId") String orgId) {
        return Result.ok(dataVisualizationService.getPatrolIncidentsCount(orgId));
    }
}
